/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {
    security:{
      csrf:{
        enable: false,
        ignoreJSON: true
      },
      domainWhiteList:["*"]
    },
  };
  config.sequelize = {
    dialect: "mysql",
    host: "39.106.69.95",
    port: '3306',
    database: "ry-vue",
    username: "root",
    password: "111111",
    timezone: "+08:00",
    dialectOptions: {
      dateStrings: true,
      typeCast(field, next) {
        // for reading from database
        if (field.type === "DATETIME") {
          return field.string();
        }
        return next();
      }
    }
  };

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1615527716154_6135';

  // add your middleware config here
  config.middleware = ['jwtErr',"visitlog"];

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
    cors:{
      origin:["http://127.0.0.1:8888"],
      credentials:true,
      allowMethods:'GET,HEAD,PUT,POST,DELETE,PATCH'
    },
    multipart:{
      fileExtensions:['.xlsx','.docx','.doc','.xls','.exe','.txt','.m4a','.aac','.wav','.pcm']
    },
    jwt:{
      secret:"sifnsis"
    },
    bodyParser:{
      // 值的大小可以根据自己的需求修改
      formLimit: '30mb',
      jsonLimit: '30mb',
      textLimit: '30mb'
    },
    session:{
      key:"admin-token",
      maxAge:24*3600*1000,
      httpOnly:true,
      encrypt:true,
      renew:true
    },
    
  };

  return {
    ...config,
    ...userConfig,
  };
};
